package com.liang.service.impl;


import com.liang.mapper.CoordinateDAO;
import com.liang.pojo.Coordinate;
import com.liang.service.CoordinateService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 *@作者:lsk
 *Service实现类
 *@Date:2023/10/25
*/
@Service
public class CoordinateServiceImpl implements CoordinateService {


	@Resource
	private CoordinateDAO coordinatedao;


	/**
	根据Map_id查询
	*/
	public Object selectByMap_id(Long map_id){
		return coordinatedao.selectByMap_id(map_id);
	}


	/**
	根据Map_id更新
	*/
	public Integer updateByMap_id(Coordinate demo){
		return coordinatedao.updateByMap_id( demo);
	}



	/**
	根据Map_id删除
	*/
	public Integer deleteByMap_id(Long map_id){
		return coordinatedao.deleteByMap_id(map_id);
	}





	/**
	 insert:(插入)
	*/
	public Object insert(Coordinate demo){
		coordinatedao.insertlsk(demo);
		return demo;
	}



	/**
	 insertOrUpdate(插入或更新(根据主键或唯一索引更新，主键和唯一索引不会改变))
	*/
	public Integer insertOrUpdate(Coordinate demo){
		return coordinatedao.insertOrUpdatelsk(demo);
	}



	/**
	 insertBath:(批量插入)
	*/
	public Integer insertBatch(List<Coordinate> list){
		return coordinatedao.insertBatchlsk(list);
	}



	/**
	 insertOrUpdateBatch:(批量插入或更新)
	*/
	public Integer insertOrUpdateBatch(List<Coordinate> list){
		return coordinatedao.insertOrUpdateBatchlsk(list);
	}



	/**
	 selectList:(根据参数查询集合)
	*/
	public List<Coordinate> selectList(Map<String,Object> param){
		if(param.get("pageNum") != null){
			int start = Integer.parseInt(param.get("pageSize").toString()) * (Integer.parseInt(param.get("pageNum").toString()) - 1);
			param.put("pageNum",start);
		}
		return coordinatedao.selectListlsk(param);
	}



	/**
	 selectCount:(根据集合查询数量)
	*/
	public Long selectCount(Map<String,Object> param){
		return coordinatedao.selectCountlsk(param);
	}



}